package com.klf.system.bo;

import java.util.List;

import com.googlecode.jsonplugin.annotations.JSON;
import com.klf.po.SysMenu;
import com.klf.po.Users;
import com.klf.system.dao.SysMenuDAOImpl;

public class SysMenuBoImpl implements ISysMenuBo {
	
	@SuppressWarnings("unused")
	private SysMenuDAOImpl sysMenuDAOImpl;
	

	@JSON(serialize = false)
	public SysMenuDAOImpl getSysMenuDAOImpl() {
		return sysMenuDAOImpl;
	}

	public void setSysMenuDAOImpl(SysMenuDAOImpl sysMenuDAOImpl) {
		this.sysMenuDAOImpl = sysMenuDAOImpl;
	}

	public boolean add(Object obj){
		// TODO Auto-generated method stub
		try {
			SysMenu c = (SysMenu)obj;
			sysMenuDAOImpl.add(c);
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public boolean delete(Long[] id) {
		// TODO Auto-generated method stub
		try {
			sysMenuDAOImpl.deleteByIds(SysMenu.class, id);
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public boolean delete(Long id) {
		// TODO Auto-generated method stub
		try {
			sysMenuDAOImpl.deleteById(SysMenu.class, id);
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public List<SysMenu> getAll(String className) {
		// TODO Auto-generated method stub
		try {
			List list = sysMenuDAOImpl.getAll(className);
			List<SysMenu> ls = list;
			return ls;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
	public List<SysMenu> getAll(String className,int start,int limit) {
		// TODO Auto-generated method stub
		try {
			List ls =  sysMenuDAOImpl.getPageObject(className,start,limit);
			List<SysMenu> rs =ls;
			return rs;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public Object getObjectById(Long id) {
		// TODO Auto-generated method stub
		try {
			return sysMenuDAOImpl.getObjectById(SysMenu.class, id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public boolean update(Object obj) {
		// TODO Auto-generated method stub
		try {
			sysMenuDAOImpl.update(obj);
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}


}
